//
//  CustomView.m
//  test02
//
//  Created by lzh on 2020/10/22.
//  Copyright © 2020 NO. All rights reserved.
//

#import "CustomView.h"

@implementation CustomView

-(void)drawRect:(CGRect)rect{
    
    /*
    [[UIColor redColor]setFill];
    UIRectFill(rect);
    
    // 这种方法 是无法 裁剪 并且 填充颜色的
    CGContextRef context = UIGraphicsGetCurrentContext();

    UIBezierPath * path = [UIBezierPath bezierPath];

    [path moveToPoint:CGPointMake(0, 20)];
    [path addLineToPoint:CGPointMake(0, rect.size.height)];
    [path addLineToPoint:CGPointMake(rect.size.width, rect.size.height)];
    [path addLineToPoint:CGPointMake(rect.size.width, 20)];
    [path addQuadCurveToPoint:CGPointMake(0, 20) controlPoint:CGPointMake(rect.size.width/2.0, 5)];
    CGContextAddPath(context, [path CGPath]);

    CGContextStrokePath(context);
     */
    
    
    /*
     
     //画三角形
     //只要三个点就行跟画一条线方式一样，把三点连接起来
     CGPoint sPoints[3];//坐标点
     sPoints[0] =CGPointMake(100, 220);//坐标1
     sPoints[1] =CGPointMake(130, 220);//坐标2
     sPoints[2] =CGPointMake(130, 160);//坐标3
     CGContextAddLines(context, sPoints, 3);//添加线
     CGContextClosePath(context);
     CGContextDrawPath(context, kCGPathFillStroke); //根据坐标绘制路径
     */
    
    
    
}

@end
